package com.xuecheng.auth.domain.feginclient.fallback;

import com.xuecheng.auth.domain.feginclient.CheckCodeServiceClient;
import com.xuecheng.auth.domain.model.dto.CheckCodeVerifyDto;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @Author: LiJunXi
 * @Description:
 * @Date: 2024-09-08  13:51
 */
@Slf4j
@Component
public class CheckCodeServiceFallback implements FallbackFactory<CheckCodeServiceClient> {
    @Override
    public CheckCodeServiceClient create(Throwable throwable){
        return new CheckCodeServiceClient() {
            @Override
            public Boolean verify(CheckCodeVerifyDto checkCodeVerifyDto) {
                log.error("调用验证码服务验证验证码发生熔断，异常信息:{}", throwable.toString(), throwable);
                return null;
            }
        };
    }
}
